package com.leyou.item.api;

import com.leyou.common.pojo.PageResult;
import com.leyou.item.bo.SpuBo;
import com.leyou.item.pojo.Sku;
import com.leyou.item.pojo.Spu;
import com.leyou.item.pojo.SpuDetail;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;

public interface GoodsApi {

    /**
     * 删除商品库存
     */
    @GetMapping("/goods/delelte/{id}/{num}")
    public Boolean delelteStockBySkuId(@PathVariable("id")Long id,@PathVariable("num")Integer num);



    //分页查询spu数据
    @GetMapping("/spu/page")
    public PageResult<SpuBo> querySpuByPage(
            @RequestParam(value = "page", defaultValue = "1") Integer page,
            @RequestParam(value = "rows", defaultValue = "5") Integer rows,
            @RequestParam(value = "saleable", required = false) Boolean saleable,
            @RequestParam(value = "key", required = false) String key,
            @RequestParam(value = "desc", defaultValue = "false") Boolean desc,
            @RequestParam(value = "sortBy", required = false) String sortBy);

    //通过id查询spu
    @GetMapping("spu/{id}")
    public Spu querySpuById(@PathVariable("id") Long id);

    ///通过spuId查询spuDetail
    @GetMapping("/spu/detail/{spuId}")
    public SpuDetail querySpuDetailBySpuId(@PathVariable("spuId") Long spuId);

    //通过spuId查询skus
    @GetMapping("/sku/list")
    public List<Sku> querySkusBySpuId(@RequestParam("id") Long spuId);

    //通过id查询sku
    @GetMapping("sku/{id}")
    public Sku querySkuById(@PathVariable("id") Long id);
}
